Repository navigation
sensor: six recovered hi3516cv6xx drivers, checked against Sony's sheets and upstream STARVIS 2 - #301
Conversation
An IMX675 (STARVIS 2, 5 MP) driver on the cv6xx cis framework. The SIP-K662C6S module's stock firmware has no MPP driver for it, only the register bring-up, inlined (sub_AB358 for 5M, sub_ABB80 for 4M). Those tables are taken as they stand. The register map, exposure and gain model, AWB and ISP tables come from sony_imx664, the nearest STARVIS 2 sibling the firmware carries, and are untuned for the IMX675. - 2592x1944 and 2592x1520 (an even, centred crop), 30 fps RAW10, 4 lanes at 594 Mbps, 37.125 MHz; VMAX 2200, HMAX 1125. - Mirror and flip on HREVERSE/VREVERSE, kept per pipe, written in standby by every bring-up and live by the callback. - The imx662 hardening: sensor lock around bring-up, SHR0 underflow guard, VMAX/SHR0 seeded before AE, checked bring-up, _Static_assert on each ISP byte image, and the Bayer NR re-lay of #296. Checked against Sony's IMX675 Standard Register Setting Ver1.0 (column 4lane, 10bit, 594Mbps, 30fps) and the upstream Linux sony-starvis2 v7 series (OpenIPC/firmware#2736). Every register the sheet sets matches, except 25 analog values where the vendor table is an earlier revision: 0x3c0a-0x3c0f, 0x4550-0x4564 and 0x347b. Both references agree on those, so they follow Sony; each is marked with the vendor's value. LANEMODE is left at reset (4 lanes), where HMAX 1125 clears both references' shortest line. Not run on an IMX675 yet.
The IMX664 (STARVIS 2, 4 MP) driver of the SIP-K662C6S module's stock firmware, recovered from that firmware and rebuilt against this tree's sensor interface and common/sensor_common.c, as sony_imx662 was in #296: its power-on table, exposure and gain model (0.3 dB ladder, high conversion gain above analog index 99), AWB calibration and ISP default tables. - 2688x1520 30 fps RAW12, 2 lanes at 1188 Mbps, 37.125 MHz. - Mirror and flip on HREVERSE/VREVERSE, per pipe, as sony_imx662. - The imx662 hardening, and the same Bayer NR re-lay: the vendor's NR image is byte-identical to imx662's. The table is the vendor's, byte for byte. Neither Sony's IMX662 sheet nor the upstream STARVIS 2 driver covers the IMX664, so it has no register oracle. Its ADBIT (0x3022) value 2 is not one the sibling sheets define; it is kept and noted. Not run on an IMX664 yet.
…2 driver The K662C6S firmware has only scene tuning for the IMX678 (STARVIS 2, 8 MP), no driver. This one starts from Sony's Hi3519DV500 driver, a self-contained driver with its own I2C layer, and is rewritten onto the cv6xx cis framework with sony_imx662's structure and hardening. - One mode: 3840x2160 30 fps RAW12, 4 lanes at 1188 Mbps, 37.125 MHz; VMAX 2250, HMAX 1100. The source's 60 fps mode is dropped: its init only ever wrote the 4K30 table. - The init table is the source's, with SHR0 seeded at 4 (Sony's minimum, not 3). It also adds the 13 registers the upstream Linux sony-starvis2 v7 table sets and the source did not. Against that table there are no value mismatches over its ~370 registers (OpenIPC/firmware#2736). - Gain: the IMX678's own 27-step HCG offset, switched above analog index 99. The source switched at 27, which would write gain codes below 34 under HCG, and Sony's reference forbids those. - The IMX678's own AWB, colour matrix and DNG colour. Its Bayer NR, DRC, LSC and ACS are imx664 byte images, and its CA is sc450ai's; each is a _Static_assert-guarded b[N]. Mesh shading off, as the vendor ships every CV610 sensor. The sharpen fields CV610 has and the Hi3519DV500 lacks are filled from imx664. - Mirror and flip on HREVERSE/VREVERSE; RGGB in every orientation, as upstream. Not run on an IMX678 yet, and 4K30 throughput on CV610 is unmeasured.
The K662C6S board's default sensor, the IMX415 (original STARVIS, 8 MP). The bring-up is the stock firmware's (sub_A9278 8M, sub_A9A8C 2M binning). The gen-1 exposure and gain model (no conversion gain) and the AWB come from the Hi3516CV500 driver, and the ISP tables are the firmware's IMX335 tables, untuned for the IMX415. - 3840x2160 and 1920x1080 2x2 binning, 30 fps RAW10, 4 lanes at 891 Mbps, 37.125 MHz; VMAX 2250, HMAX 1100. - The CFA is GBRG, as the CV500 driver, mainline Linux (SGBRG10) and the OpenIPC CV500 profile have it; the extraction had carried RGGB over from its IMX335 template. - Mirror and flip on 0x3030. The inverted readout starts one pixel further in, so the Bayer phase stays put. - The imx662 hardening and Bayer NR re-lay; mesh shading off, since the IMX335 grid fits no IMX415 mode (#299). Checked against mainline drivers/media/i2c/imx415.c (its init table, the 891 Mbps link table and the 37.125 MHz clock parameters): no value mismatches. HMAX 1100 is the 4-lane shortest line at that rate. 0x30c0/0x30c1 (sync pin outputs) stay at reset, high impedance, as the vendor runs them. Not run on an IMX415 yet.
The SmartSens SC850SL (8 MP) driver of the SIP-K662C6S stock firmware, which
has no SDK counterpart. Its init is unrolled in the firmware, not a table, and
was recovered write by write. Its ISP default tables come byte for byte from
the firmware's callback set (sub_B4538); the gain tables are SmartSens-standard
and were checked against the binary. Laid out as smart_sc450ai.
- 27 MHz sensor clock ("27MInput_4lane_1080Mbps_12bit").
- Both Bayer NR images had the #296 layout skew and are re-laid.
- Hardening as sony_imx662. Standby and restart drive 0x0100; the vendor's were
empty.
- Mirror and flip on 0x3221, relative to the 0x66 the init writes (the module
is mounted rotated). BGGR in every orientation, as the XMedia SC850SL driver
reports it.
Not run on an SC850SL yet.
The GalaxyCore GC2063 (2 MP, GC2053 register-compatible), laid out as
galaxycore_gc4653. The init is the stock firmware's (sub_AE770), and it is
write for write the Hi3516CV500 GC2053 1080p30 sequence. The exposure and gain
model and the AWB come from that driver. The ISP tables are gc4023's, untuned
for the GC2063.
- 1920x1080 30 fps RAW10, 27 MHz ("gc2063 27Mclk 2M30fps(MIPI)").
- AE as the GC2053 drivers and gc4653 sync it: shutter and gain one frame
after VMAX.
- RGGB, the order the OpenIPC GC2053 profiles run this same table with.
- Mirror and flip on page-0 0x17. The GC2053 references move no window for
it. Not verified on a GC2063.
- Hardening as sony_imx662. Standby and restart use 0xf2/0xfc, as the CV500
driver does.
Not run on a GC2063 yet.
Sony's IMX662 register setting sheet and the upstream Linux STARVIS 2 driver (since v7's exposure fix) put SHR0 in [4, VMAX - 1]. The driver clamped it at 3, and it told AE that VMAX - 2 lines was the longest exposure, which that clamp never allowed. Both are now 4. The longest exposure is one line shorter, and AE is told exactly what it gets. Found while checking the cv6xx STARVIS 2 drivers against those references (OpenIPC/firmware#2736).
…mx675, imx678 GC2063 and SC850SL run at 27 MHz, as their vendor banners say. The four Sony sensors run at 37.125 MHz, as INCK_SEL in each init table says. Without an entry, the sensor clock is written 0 and the sensor stays dark.
Adds the six drivers above, and GC4653, MIS20S1, CV2003 and VS4388, which had drivers but no rows.
PR Summary by QodoAdd six recovered Hi3516CV6xx sensor drivers
AI Description
Diagram
High-Level Assessment
Files changed (51)
|
Code Review by Qodo
1.
|
- sc850sl: the bring-up seeded only the linear-mode slots, so a 2-to-1 WDR bring-up replayed zero long and short exposure, gains and short-exposure limit over the WDR table. Each is now seeded from the WDR table's own values (long 0x1000, short 0x100, limit 0x10a, 1x gain), and only where AE has not written yet. - sc850sl: the pixel-calibration hooks wrote VMAX low byte first to 0x320e, its high byte, and the exposure as plain bytes. On leaving they wrote back fl_std, which is in half lines. They now write VMAX high byte first and the exposure in half lines with the 4/8/4 split cmos_inttime_update_linear() uses, and leave with fl_std >> 1. - imx675, imx664, imx415: AE was told the longest exposure was VMAX - 2 (VMAX - 8 on the IMX415), but SHR0 stays at 6 (9) or above, so the longest is VMAX - 6 (VMAX - 9). FL_OFFSET_LINEAR now equals SHR0_MIN, and AE is told what it gets. - gc2063: the analog-gain ceiling stays at 113168, below the table's last entry, as the Hi3516CV500 GC2053 driver has it; now said beside the define.
|
Review round (Qodo):
All six drivers still build with |
Six sensor drivers for Hi3516CV610/CV608, recovered from the SIP-K662C6S module's stock firmware and sibling SDKs, on the cv6xx cis framework with sony_imx662's structure and hardening (#296/#298):
The vendor day-scene IQ for these sensors goes to the OpenIPC firmware as
iq/<sensor>.ini, in a follow-up there.Register validation (OpenIPC/firmware#2736)
The init tables were checked against Sony's Standard Register Setting sheets and the upstream Linux
sony-starvis2v7 series. The method was first run onsony_imx662, which works on hardware.imx415.c(its init table, the 891 Mbps link table and the 37.125 MHz clock parameters). The CFA is GBRG, not the RGGB the extraction had carried over.sony_imx662clamped at 3 and told AE VMAX-2; it now uses 4 on both sides (its own commit).Other fixes made during the port:
Verification
make CHIPARCH=hi3516cv6xxwith the cv6xx toolchain builds all 20 sensor libraries with no warnings.-Wall -Wextra -Werror..soexportsg_sns_<sensor>_objand needs only libc.None of the six has run on its sensor yet. The lab module carries an IMX662.